package com.minimalist.common.entity.lindi.vo.laws;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.config.swagger.SchemaEnum;
import com.minimalist.common.entity.basic.enums.StatusEnum;
import com.minimalist.common.entity.basic.vo.file.FileVO;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;

/**
 * @author 11987
 */

@Schema(name = "林地指标平台_政策法规实体")
public class LindiLawsVO implements Serializable{
    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "政策法规ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "lawsId", description = "政策法规ID", type = "string")
    private Long lawsId;

    @NotBlank(message = "政策法规标题不能为空", groups = {Add.class, Update.class})
    @Schema(name = "lawsTitle", description = "政策法规标题", type = "string")
    private String lawsTitle;

    @Schema(name = "lawsContent", description = "政策法规内容", type = "string")
    private String lawsContent;

    @Schema(name = "lawsFileId", description = "附件文件ID，多个使用逗号分割", type = "string")
    private String lawsFileId;

    @Schema(name = "lawsFiles", description = "附件文件列表", type = "array")
    private List<FileVO> lawsFiles;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(name = "publishTime", description = "发布时间", type = "string")
    private String publishTime;

    @NotNull(message = "政策法规状态不能为空", groups = {Add.class, Update.class})
    @SchemaEnum(implementation = StatusEnum.class)
    @Schema(name = "status", description = "政策法规状态", type = "string")
    private Integer status;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "createId", description = "创建人ID", type = "string")
    private Long createId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "updateId", description = "更新人ID", type = "string")
    private Long updateId;

    @Schema(name = "createTime", description = "创建时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime createTime;

    @Schema(name = "updateTime", description = "更新时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime updateTime;

    public LindiLawsVO(){
    }

    public Long getLawsId(){
        return lawsId;
    }

    public void setLawsId(Long lawsId){
        this.lawsId = lawsId;
    }

    public String getLawsTitle(){
        return lawsTitle;
    }

    public void setLawsTitle(String lawsTitle){
        this.lawsTitle = lawsTitle;
    }

    public String getLawsContent(){
        return lawsContent;
    }

    public void setLawsContent(String lawsContent){
        this.lawsContent = lawsContent;
    }

    public String getLawsFileId(){
        return lawsFileId;
    }

    public void setLawsFileId(String lawsFileId){
        this.lawsFileId = lawsFileId;
    }

    public List<FileVO> getLawsFiles(){
        return lawsFiles;
    }

    public void setLawsFiles(List<FileVO> lawsFiles){
        this.lawsFiles = lawsFiles;
    }

    public String getPublishTime(){
        return publishTime;
    }

    public void setPublishTime(String publishTime){
        this.publishTime = publishTime;
    }

    public Integer getStatus(){
        return status;
    }

    public void setStatus(Integer status){
        this.status = status;
    }

    public Long getCreateId(){
        return createId;
    }

    public void setCreateId(Long createId){
        this.createId = createId;
    }

    public Long getUpdateId(){
        return updateId;
    }

    public void setUpdateId(Long updateId){
        this.updateId = updateId;
    }

    public LocalDateTime getCreateTime(){
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime){
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime){
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o){
        if (this == o){
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        LindiLawsVO lindiLawsVO = (LindiLawsVO) o;
        return Objects.equals(lawsId, lindiLawsVO.lawsId) && Objects.equals(lawsTitle, lindiLawsVO.lawsTitle) && Objects.equals(lawsContent, lindiLawsVO.lawsContent) && Objects.equals(lawsFileId, lindiLawsVO.lawsFileId) && Objects.equals(lawsFiles, lindiLawsVO.lawsFiles) && Objects.equals(publishTime, lindiLawsVO.publishTime) && Objects.equals(status, lindiLawsVO.status) && Objects.equals(createId, lindiLawsVO.createId) && Objects.equals(updateId, lindiLawsVO.updateId) && Objects.equals(createTime, lindiLawsVO.createTime) && Objects.equals(updateTime, lindiLawsVO.updateTime);
    }

    @Override
    public int hashCode(){
        return Objects.hash(lawsId, lawsTitle, lawsContent, lawsFileId, lawsFiles, publishTime, status, createId, updateId, createTime, updateTime);
    }
}
